package com.app.factories
{
	import com.adobe.serialization.json.JSONDecoder;
	import com.app.vo.DosenVO;
	
	import mx.controls.Alert;

	public class DosenFactory
	{
		public static function buildArrayFromJson(json:String):Array{     
			var parsedArray:Array= new JSONDecoder( json ).getValue();
            return parsedArray;
		}
		
		public static function buildInfoDosen(data:String,dsnVo:DosenVO):DosenVO{
		  var output:Array=buildArrayFromJson(data);
		  dsnVo.dosenId = output[0]['DOSEN_ID'];
          dsnVo.dosenNama = output[0]['DOSEN_NAMA'];
          dsnVo.dosenAlamatkantor = output[0]['DOSEN_ALAMAT_KANTOR'];
          dsnVo.dosenAlamatRumah = output[0]['DOSEN_ALAMAT_RUMAH'];
          dsnVo.dosenNoTelp = output[0]['DOSEN_NO_TELP'];
          dsnVo.dosenEmail = output[0]['DOSEN_EMAIL'];
          dsnVo.dosenStatus = output[0]['DOSEN_STATUS'];
          return dsnVo;
		}
		
		public static function buildListMahasiswa(data:String,dsnVo:DosenVO):DosenVO{
		  var output:Array = buildArrayFromJson(data);
		  dsnVo.dosenMhsList = output;
		  return dsnVo;
		}

	}
}